1. Field of the Invention:
The present invention relates to an exponential calculation device and a decoding device for performing a predetermined calculation for a given encoded bit stream. More particularly, the present invention relates to an exponential calculation device for calculating x{circumflex over ( )}(a/b) and a decoding device for calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) for given integer values x and y contained in a bit stream which has been encoded based on the MPEG (moving picture experts group) 2 audio encoding standard xe2x80x9cAACxe2x80x9d.
2. Description of the Related Art:
Conventionally, in order to calculate z=x{circumflex over ( )}(a/b) for a given value of x (where a and b are constant values), values of x{circumflex over ( )}(a/b) for all the possible values of x are stored in a table whose addresses are associated with the respective values of x. The value of z for a given value of x is obtained by reading out the value stored in the table.
In this specification, xe2x80x9cx to a power of (a/b)xe2x80x9d is represented as xe2x80x9cx{circumflex over ( )}(a/b)xe2x80x9d, where the symbol xe2x80x9c{circumflex over ( )}xe2x80x9d denotes the use of an exponential function, and the symbol xe2x80x9c/xe2x80x9d denotes a division function. The symbolxe2x80x9c*xe2x80x9d will also be used herein to denote a multiplication function.
FIG. 27 illustrates a table containing values of x{circumflex over ( )}(4/3) for values of x in a range of 0xe2x89xa6xc3x97xe2x89xa68191. A decoding operation based on the MPEG 2 audio encoding standard AAC requires calculation of x{circumflex over ( )}(4/3) for a value of x in the range from 0 to 8191. When the conventional method of obtaining the value of x{circumflex over ( )}(a/b) is employed in the exponential calculation involved in decoding data encoded based on the MPEG 2 audio encoding standard AAC, an input value of x is used as an address for reading out the corresponding value from a table provided in advance, as illustrated in FIG. 27, to obtain the value of x{circumflex over ( )}(4/3) an output value z.
In order to decode an encoded bit stream so as to obtain the intended data, it is necessary to perform a predetermined calculation process. A bit stream encoded based on the MPEG 2 audio encoding standard AAC contains a quantization code xe2x80x9cxxe2x80x9d and a scaling factor xe2x80x9cyxe2x80x9d. The quantization code xe2x80x9cxxe2x80x9d and the scaling factor xe2x80x9cyxe2x80x9d are both integers. In the case of the MPEG 2 audio encoding standard AAC, the decoding device calculates x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) (where a, b and c are constants) for given values of x and y. Details of the MPEG 2 audio encoding standard AAC are disclosed in ISO/IEC 13818-7:1997, pp.57-59.
Conventionally, an operation of calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) for given values of x and y has been performed as follows with a DSP (digital signal processor) of a fixed point format.
FIG. 28 illustrates an exemplary 32-bit fixed point format. Referring to FIG. 28, where the bit 0 is the least significant bit and the bit 31 is the most significant bit, the decimal point is fixed between the bit 30 and the bit 29. In particular, bit 30 represents the integral portion of a value, while the bits 29-0 represent the fractional portion of the value. Bit 31 is the sign bit indicating whether the value is positive or negative. Such a numeric representation with a fixed decimal point is called a xe2x80x9cfixed point formatxe2x80x9d.
For example, a value xe2x80x9cfxe2x80x9d represented in the 32-bit fixed point format, as illustrated in FIG. 28, can vary in the range of xe2x88x922xe2x89xa6f less than 2. Then, in order to perform a calculation with a fixed-point-format processing unit, such as a DSP, values involved in the calculation are adjusted so that they are each in the range of xc2x12.0 before performing the intended calculation.
In the MPEG 2 audio encoding standard AAC, x can vary in the range of 0xe2x89xa6x less than 8192, whereas y can vary in the range of xe2x88x92100xe2x89xa6y less than 156. Consider a calculation of Expression (1) below for x and y having such ranges.
x{circumflex over ( )}(4/3)*2{circumflex over ( )}(y/4)xe2x80x83xe2x80x83(1)
Expression (1) may be calculated as follows based on the prior art technique with a fixed-point-format processing unit. First, Expression (1) is converted to Expression (2) below.
x{circumflex over ( )}(4/3)*2{circumflex over ( )}((y%4)/4)*2{circumflex over ( )}int(y/4)xe2x80x83xe2x80x83(2)
In Expression (2), xe2x80x9c(y%4)xe2x80x9d represents a remainder of a division y/4, and xe2x80x9cint(y/4)xe2x80x9d represents a quotient (integer) of the division y/4. In the calculation of Expression (2), x{circumflex over ( )}(4/3) is first calculated. The calculation x{circumflex over ( )}(4/3) is typically performed using a ROM table. In particular, values of x{circumflex over ( )}(4/3) for various values of x are calculated and stored in a table in advance. Then, the value of x{circumflex over ( )}(4/3) for a given value of x is obtained by referencing the ROM table using the value of x as the address of the table.
The calculation of Expression (1) or (2) assumes the use of a fixed-point-format processing unit. In particular, different values of x{circumflex over ( )}(4/3) are normalized and stored in a table in advance, with the maximum value thereof being normalized to a value which does not exceed 1.0.
FIG. 29 illustrates the contents of a first table for use with a conventional decoding device. The table illustrated in FIG. 29 contains values of f(x) for the range of 0xe2x89xa6x less than 8192 at addresses which correspond to the respective values of x. The values of f(x) are obtained by first calculating x{circumflex over ( )}(4/3) for various values of x, and then dividing the calculated values by 2{circumflex over ( )}18 to normalize the values so that none of them exceeds 1.0.
In the calculation of Expression (2), 2{circumflex over ( )}((y%4)/4) is then calculated. Typically, 2{circumflex over ( )}((y%4)/4) is also calculated using a ROM table. In particular, different values of 2{circumflex over ( )}((y%4)/4) for various integers (y%4) are calculated and stored in a table in advance. Then, an integer (y%4) is used as an address for referencing the table so as to obtain the value of 2{circumflex over ( )}((y%4)/4) for the integer (y%4).
FIG. 30 illustrates the contents of a second table for use with a conventional decoding device. The second table illustrated in FIG. 30 contains values of g(y) for the address values (y%4) in the range from 0 to 3. The values of g(y) are obtained by normalizing values of 2{circumflex over ( )}((y%4)/4) so that none of them exceeds 2.0.
After such a table is provided, the value of Expression (2) can be obtained. First, the first table illustrated in FIG. 29 is referenced using an input integer x as an address so as to obtain the normalized value f(x) for x{circumflex over ( )}(4/3). Then, (y%4) is calculated for a given integer of y. Subsequently, the calculated value of (y%4) is used as an address to obtain a value of g(y)=2{circumflex over ( )}((y%4)/4) from the second table illustrated in FIG. 30. Then, a multiplier is used to calculate f(x)*g(y) so as to obtain a multiplied value f(x)*g(y)=h(x,y). Since the obtained value f(x) is within the range of xc2x11 while the obtained value g(y) is within the range of xc2x12, the multiplication result h(x,y) should always has a value in the range of xc2x12.
Then, h(x,y) is multiplied by 2{circumflex over ( )}int(y/4) so as to obtain a multiplied value i(x,y) as a calculation result of Expression (2). The multiplication can be performed by a bit shift operation. In the bit shift operation, it is assumed that a limit operation (so called a xe2x80x9cclipping operationxe2x80x9d) is performed when the final calculation result exceeds the range of xc2x12. Thus, in the prior art, the calculation i(x,y)=x{circumflex over ( )}(4/3)*2{circumflex over ( )}(y/4) is performed using a large-capacity table.
Use of the above conventional method for obtaining a value of x{circumflex over ( )}(a/b) requires a large memory area for the table containing different values of x{circumflex over ( )}(a/b). For example, assuming that the stored values of x{circumflex over ( )}(a/b) are 32-bit fixed point values, the table illustrated in FIG. 27 would require a memory area of 32 K bytes. Thus, when x has a wide variable range, large-scale hardware has to be employed for the large memory area required.
Moreover, in the conventional method of calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c), the number of significant digits of the calculated value f(x) is undesirably small for relatively small input integers of x, as those in the upper portion of FIG. 29. For example, the value f(x) corresponding to address x=2 uses only the lower 14 bits of the 32 bits that are available. Thus, a calculation performed by using such a table results in a poor accuracy in the calculation result. Moreover, the conventional calculation method employs a wide range of x (i.e., 0-8191), and accordingly requires a memory area as large as 8191*32 bits. Consequently, a conventional decoding device requires a table having a very large capacity.
According to one aspect of the invention, an exponential calculation device for calculating x{circumflex over ( )}(a/b) (where a and b are each an integer constant) for a given input value of x is provided. The device includes: an input control section for outputting a value of xxe2x80x2, wherein xxe2x80x2=x when xxe2x89xa6A (where A is a threshold value within a variable range of x) and xxe2x80x2=x/2{circumflex over ( )}b when x greater than A; a core section for outputting a value of zxe2x80x2=xxe2x80x2{circumflex over ( )}(a/b); and an output control section for outputting a value of z, wherein z=zxe2x80x2 when xxe2x89xa6A and z=zxe2x80x2*2{circumflex over ( )}a when x greater than A.
In one embodiment of the invention, the input control section calculates the value of xxe2x80x2 by shifting x down by b bits when x greater than A.
In another embodiment of the invention, the core section stores in a table values of xxe2x80x2{circumflex over ( )}(a/b) for all possible values of xxe2x80x2 (where 0xe2x89xa6xxe2x80x2xe2x89xa6A).
In still another embodiment of the invention, A is set to a value such that x is less than or equal to A at a frequency equal to or greater than a predetermined value.
According to another aspect of this invention, an exponential calculation device for calculating x{circumflex over ( )}(a/b) (where a and b are each an integer constant) for a given input value of x is provided. The device includes: an input control section for outputting a value of xxe2x80x2, wherein xxe2x80x2=x when xxe2x89xa6A (where A is a threshold value within a variable range of x) and xxe2x80x2=x/2{circumflex over ( )}(b*n) when x greater than A (where n is an integer which satisfies x/2{circumflex over ( )}(b*n)xe2x89xa6A); a core section for outputting a value of zxe2x80x2=xxe2x80x2{circumflex over ( )}(a/b); and an output control section for outputting a value of z, wherein z=zxe2x80x2 when xxe2x89xa6A and z=zxe2x80x2*2{circumflex over ( )}(a*n) when x greater than A.
In one embodiment of the invention, the input control section calculates the value of xxe2x80x2 by shifting x down by (b*n) bits when x greater than A.
In another embodiment of the invention, the core. section stores in a table values of xxe2x80x2{circumflex over ( )}(a/b) for all possible values of xxe2x80x2 (where 0xe2x89xa6xxe2x80x2xe2x89xa6A).
In still another embodiment of the invention, A is set to a value such that x is less than or equal to A at a frequency equal to or greater than a predetermined value.
According to still another aspect of this invention, an exponential calculation device for calculating x{circumflex over ( )}(a/b) (where a and b are each an integer constant) for a given input value of x is provided. The device includes: an input control section for outputting a value of xxe2x80x2, wherein xxe2x80x2=x when xxe2x89xa6A (where A is a threshold value within a variable range of x) and xxe2x80x2=x/2{circumflex over ( )}b when x greater than A; a core section for outputting a value of zxe2x80x2=xxe2x80x2{circumflex over ( )}((a%b)/b); an output control section for outputting a value of z, wherein z=zxe2x80x2 when xxe2x89xa6A and z=zxe2x80x2*2{circumflex over ( )}(a%b) when x greater than A; and a multiplication section for outputting z*(x{circumflex over ( )}(int(a/b))).
In one embodiment of the invention, A is set to a value such that x is less than or equal to A at a frequency equal to or greater than a predetermined value.
According to still another aspect of this invention, an exponential calculation device for calculating x{circumflex over ( )}(a/b) (where a and b are each an integer constant) for a given input value of x is provided. The device includes: a determination section for outputting a parameter j (j is an integer which is not negative) for specifying a value of x; an input control section for outputting a value of xxe2x80x2, wherein xxe2x80x2=x when xxe2x89xa6A (where A is a threshold value within a variable range of x) and xxe2x80x2=x/2{circumflex over ( )}j when x greater than A; a core section for outputting a value of zxe2x80x2=xxe2x80x2{circumflex over ( )}(a/b); and an output control section for outputting a value of z, wherein z=zxe2x80x2 when xxe2x89xa6A and z=zxe2x80x2*2{circumflex over ( )}(j*a/b) when x greater than A.
In one embodiment of the invention, the output control section includes a memory section for storing values of 2{circumflex over ( )}(j*a/b) using j as an address; and the value of z is calculated by reading out a corresponding value of 2{circumflex over ( )}(j*a/b) from the memory section when x greater than A.
In another embodiment of the invention, A=2{circumflex over ( )}B (B is an integer constant); and the determination section determines the value of j such that 2{circumflex over ( )}(B+(jxe2x88x921))xe2x89xa6x less than 2{circumflex over ( )}(B+j) when x greater than 2{circumflex over ( )}b and such that j=0 when xxe2x89xa62{circumflex over ( )}b.
According to still another aspect of this invention, an exponential calculation device for calculating x{circumflex over ( )}(a/b) (where a and b are each an integer constant) for a given input value of x is provided. The device includes: a determination section for outputting a value of k which denotes a number of digits of x represented in a binary form; an input control section for outputting a value of xxe2x80x2, wherein the value of xxe2x80x2 is obtained by shifting x up by (Bxe2x88x92k) bits when the value of (Bxe2x88x92k) is positive and by shifting x down by (kxe2x88x92B) bits when the value of (Bxe2x88x92k) is negative; a core section for outputting a value of zxe2x80x2=xxe2x80x2{circumflex over ( )}(a/b); and an output control section for outputting a value of z=zxe2x80x2*(2{circumflex over ( )}((kxe2x88x92B)*a/b)).
In one embodiment of the invention, the output control section includes a memory section for storing values of 2{circumflex over ( )}((kxe2x88x92B)*a/b) using k as an address; and the value of z is calculated by reading out a corresponding value of 2{circumflex over ( )}((kxe2x88x92B)*a/b) from the memory section.
In another embodiment of the invention, the core section includes a memory section for storing values of q{circumflex over ( )}(a/b) (where 2{circumflex over ( )}(Bxe2x88x921)xe2x89xa6q less than 2{circumflex over ( )}B, and q is an integer) using at least lower (Bxe2x88x921) bits of q as an address; and the value of zxe2x80x2 is calculated by reading out a corresponding value of q{circumflex over ( )}(a/b) from the memory section using the at least lower (Bxe2x88x921) bits of xxe2x80x2 as an address.
According to still another aspect of this invention, there is provided a decoding device for extracting a variable quantization code x and a variable scaling factor y from an input bit stream containing the quantization code x and the scaling factory and calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) (where a, b and c are each an integer constant). The device includes: an isolation section for isolating x and y from the input bit stream; a first bit shift section for, when xxe2x89xa62{circumflex over ( )}N (where N is a predetermined threshold value), shifting x by a number of bits according to N so as to convert x to x1 which is in a fixed point format; a first memory section for storing, for all possible values of q (where q is an integer such that 0xe2x89xa6qxe2x89xa62{circumflex over ( )}N), using q as an address, values of H(q) which have been converted to a fixed point format by shifting q{circumflex over ( )}((axe2x88x92b)/b) by a number of bits according to M (where M is an integer value of (N*(axe2x88x92b))/b); a second memory section for storing, for all possible values of p (where 0xe2x89xa6p less than c), values of G(p)=2{circumflex over ( )}(p/c) in a fixed point format; a division section for calculating y1, where y1=int(y/c); a modulo calculation section for calculating y2=y%c; a multiplication section for outputting a value obtained by multiplying together a value of H(x) which has been read out from the first memory section using x as an address, a value of G(y2) which has been read out from the second memory section using y2 as an address and a value of x1 which has been converted by the first bit shift section; and a second bit shift section for shifting the output value from the multiplication section by a number of bits according to y1 obtained by the division section.
In one embodiment of the invention, the number of bits according to N is (Dxe2x88x92N) (where D is a number of significant digits of a fractional portion of a number involved in a fixed point calculation operation); and the number of bits according to y1 is (y1+(N+M)).
In another embodiment of the invention, M is an integer obtained by rounding up (N*(axe2x88x92b))/b.
In still another embodiment of the invention, a=4, b=3 and c=4.
In still another embodiment of the invention, the device further includes: a determination section for outputting a determination result being true when xxe2x89xa62{circumflex over ( )}N and being false when x greater than 2{circumflex over ( )}N; and a second division section for outputting the value of x without alteration when the determination result is true and for outputting a value obtained by dividing x by (2{circumflex over ( )}(b*i)). The first bit shift section shifts x by a number of bits according to (N+b*i) (where i is an integer which is not negative) when the determination result is false. The first memory section stores values of H(q) for values of q which are within the variable range of x. The second bit shift section shifts the value output from the multiplication section by a number of bits according to y1 when the determination result is true and by a number of bits according to y1 and a*i when the determination result is false.
In still another embodiment of the invention, the number of bits according to N is (Dxe2x88x92N); the number of bits according to (N+b*i) is Dxe2x88x92(N+b*i); the number of bits according to according to M is (Dxe2x88x92M); the number of bits according to according to y1 is (y1+N+M); and the number of bits according to y1 and a*i is (y1+N+M+a*i).
In still another embodiment of the invention, the value of i is determined so that x satisfies 2{circumflex over ( )}(N+b(ixe2x88x921)) less than xxe2x89xa62{circumflex over ( )}(N+bi).
In still another embodiment of the invention, the device further includes a determination section for outputting a determination result being true when x less than 2{circumflex over ( )}N and being false when x greater than 2{circumflex over ( )}N, and further outputting a parameter i for specifying a value of x. The first bit shift section and the second division section and the second shifting section operate according to the determination result from the determination section.
In still another embodiment of the invention, the second bit shift section shifts the value output from the multiplication section by a number of bits according to y1 when the determination result is true and by a number of bits according to y1+(a*i) when the determination result is false.
According to still another aspect of this invention, there is provided a decoding device for extracting a variable quantization code x and a variable scaling factor y from an input bit stream containing the quantization code x and the scaling factory and calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) (where a, b and c are each an integer constant). The device includes: an isolation section for isolating x and y from the input bit stream; a determination section for outputting a determination result being true when xxe2x89xa62{circumflex over ( )}N (where N is a predetermined threshold value) and being false when x greater than 2{circumflex over ( )}N, and further outputting a parameter j for specifying a value of x; a first bit shift section for shifting x by a number of bits according to N when the determination result is true and by a number of bits according to (N+j) when the determination result is false so as to convert x to x1 which is in a fixed point format; a first division section for calculating y1, where y1=int(y/c); a second division section for outputting a value of xxe2x80x2, wherein xxe2x80x2=x when the determination result is true and xxe2x80x2 is an integer value of (x/(2{circumflex over ( )}j)); a first memory section for storing, for all possible values of q (where q is an integer such that 0xe2x89xa6qxe2x89xa62{circumflex over ( )}N) within a variable range of xxe2x80x2, using q as an address, values of H(q) which have been converted to a fixed point format by shifting q{circumflex over ( )}((axe2x88x92b)/b) by a number of bits according to M (where M is an integer value of (N*(axe2x88x92b))/b); an adjustment coefficient generation section for generating values of I(p,j) in a fixed point format according to 2{circumflex over ( )}(p/c)*2{circumflex over ( )}(j/b) for all possible values of p such that 0xe2x89xa6p less than c and all possible values of j; a modulo calculation section for calculating y2=y%c; a multiplication section for outputting a value obtained by multiplying together a value of H(xxe2x80x2) which has been read out from the first memory section using xxe2x80x2 as an address, a value of I(y2,j) corresponding to y2 and j which has been generated by the adjustment coefficient generation section and a value of x1 which has been converted by the first bit shift section; and a second bit shift section for shifting the output value from the multiplication section by a number of bits according to y1 when xxe2x89xa62{circumflex over ( )}N and by a number of bits according to y1 and j when x greater than 2{circumflex over ( )}N.
In one embodiment of the invention, the adjustment coefficient generation section includes a second memory section for storing values of I(p,j) using p and j as an address.
In another embodiment of the invention, the value of j is determined so as to satisfy 2{circumflex over ( )}(N+(jxe2x88x921) less than xxe2x89xa62{circumflex over ( )}(N+j) when x greater than 2{circumflex over ( )}N, whereas j=0 when xxe2x89xa62{circumflex over ( )}N.
In still another embodiment of the invention, a=4, b=3 and c=4.
According to still another aspect of this invention, there is provided a decoding device for extracting a variable quantization code x and a variable scaling factor y from an input bit stream containing the quantization code x and the scaling factor y and calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) (where a, b and c are each an integer constant). The device includes: an isolation section for isolating x and y from the input bit stream; a determination section for determining a number k of digits of x represented in a binary form; a second division section for outputting a value of xxe2x80x2, wherein the value of xxe2x80x2 is obtained by shifting x up by (Nxe2x88x92k) bits when the value of (Nxe2x88x92k) is positive and by shifting x down by (kxe2x88x92N) bits when the value of (Nxe2x88x92k) is negative; a first bit shift section for shifting x by a number of bits according to k so as to convert x to x1 which is in a fixed point format; a first division section for calculating y1, where y1=int(y/c); a first memory section for storing, using at least lower (Nxe2x88x921) bits of q (where q is an integer such that 2{circumflex over ( )}(Nxe2x88x921)xe2x89xa6q less than 2{circumflex over ( )}N) as an address, values of H(q) which have been converted to a fixed point format by shifting q{circumflex over ( )}((axe2x88x92b)/b) by a number of bits according to M (where M is an integer value of (N*(axe2x88x92b))/b); an adjustment coefficient generation section for generating values of I(p,k) in a fixed point format according to 2{circumflex over ( )}(p/c)*2{circumflex over ( )}((kxe2x88x92N)/b) for all possible values of p such that 0xe2x89xa6p less than c and all possible values of k; a modulo calculation section for calculating y2=y%c; a multiplication section for outputting a value obtained by multiplying together a value of H(xxe2x80x2) which has been read out from the first memory section using the at least lower (Nxe2x88x921) bits of xxe2x80x2 as an address, a value of I(y2,k) corresponding to y2 and k which has been generated by the adjustment coefficient generation section and a value of x1 which has been converted by the first bit shift section; and a second bit shift section for shifting the output value from the multiplication section by a number of bits according to y1, M and k.
In one embodiment of the invention, the adjustment coefficient generation section includes a second memory section for storing values of I(p,k) using p and k as an address.
In another embodiment of the invention, a=4, b=3 and c=4.
Thus, the invention described herein makes possible the advantages of: (1) reducing the hardware scale of an exponential calculation device which Is capable of calculating x{circumflex over ( )}(a/b) for a given value of x, by reducing the memory area to be used for a table; (2) realizing a decoding device capable of calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) with a high accuracy using a fixed-point-format processing unit even when the integer x is considerably smaller than the maximum value of the variable range thereof; (3) realizing a decoding device which only has a table for relatively small integers x and still Is capable of calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) even for a large value of x by using the small-capacity table; and (4) realizing a calculation method capable of a calculation involving a large value of x using a small-capacity table by the use of a simple bit shift operation, thereby realizing a decoding device capable of rapidly calculating x{circumflex over ( )}(a/b)*2{circumflex over ( )}(y/c) for any given values of x and y.
These and other advantages of the present invention will become apparent to those skilled in the art upon reading and understanding the following detailed description with reference to the accompanying figures.